package stocks.client.gui.controller.actions;

import java.awt.event.ActionEvent;
import java.rmi.RemoteException;

import javax.swing.AbstractAction;

import stocks.client.gui.model.model;

public class SendLoginAction extends AbstractAction{

	private model m;
	
	/**
	 * Constructor, takes model as a parameter
	 */
	public SendLoginAction(model m)
	{
		this.m = m;
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		
		String username = m.getLoginFrame().getUsername();
		String password = m.getLoginFrame().getPassword();
		m.setName(username);
		
		try {
			m.getRMIInterface().login(username, password); //login via rmi
			
		} catch (RemoteException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
	}
}
